<template>
  <el-dropdown style="float: right">
    <div>
      <router-link v-if="!getLoginStatus()" to="/login" style="color: white">登录</router-link>
      <i v-if="getLoginStatus()" class="el-icon-user-solid" style="color: white">
        <el-dropdown-menu>
          <el-dropdown-item>
            <span>退出登录</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </i>
    </div>
  </el-dropdown>
</template>

<script>

export default {
  name: "loginView",
  data() {
    return {
      msg: this.getLoginStatus()
    }
  },
  methods: {
    getLoginStatus() {
      if (!window.localStorage) {
        alert("浏览器不支持localstorage，请更换更高版本的浏览器")
        return false
      } else return get("isLogin") != null;
    }
  }
}
</script>
